package com.feiyu.order.controller;

import com.feiyu.common.utils.R;
import com.feiyu.order.dto.selectOrderDto;
import com.feiyu.order.service.OrderService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author: Doate
 * @Date: Created in 2021/4/9 15:29
 * @Description:
 */

@RestController
public class OrderSearchController {

    @Resource
    OrderService orderService;

    @PostMapping("/searchByParam")
    public R searchByParam(@RequestBody selectOrderDto dto, @RequestHeader("userPower") int power,@RequestHeader("userId") int userId) {

        Map<String, Object> data = orderService.searchByParam(dto, power,userId);
        return R.ok().put("data", data);
    }

    @PostMapping("/searchById")
    public R searchById(@RequestBody selectOrderDto dto) {

        Map<String, Object> data = orderService.searchById(dto.getOrderId());
        return R.ok().put("data", data);
    }


}
